/**
 * Created by Ysssssss on 2021/4/14.
 */

import React, {useCallback} from 'react'
import { Modal } from "antd";


const DoubleCheck = props => {
    const { onClick = () => {}, title, children } = props

    const doubleCheckModal = useCallback(() => {
        Modal.confirm({
            title: title || '确认删除？',
            icon: null,
            onOk: onClick
        })
    }, [onClick])

    return React.cloneElement(children, {
        onClick: doubleCheckModal
    });
}

export default DoubleCheck